package com.genITeam.ria.actions.login;

import org.apache.log4j.Logger;

import com.genITeam.ria.actions.AbstractAction;
import com.genITeam.ria.vo.LoginVo;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;

public class ValidateLogin extends AbstractAction {

	static Logger logger = Logger.getLogger(ValidateLogin.class);
	public void execute() throws Exception {
		logger.info("function called");
		XStream xstream=new XStream(new DomDriver());
		xstream.alias("LoginVo",LoginVo.class);
		LoginVo loginVo=(LoginVo)xstream.fromXML(this.getXMLInput());
		logger.info("Login Vo Received :"+loginVo.getUserName());
		loginVo.setUserName("Khurram");
		loginVo.setPassword("");
		loginVo.setLoggedIn(true);
		logger.info("Response: "+xstream.toXML(loginVo));
		this.writeResponse(xstream.toXML(loginVo));
	}


	public boolean requiresAuthentication() {
		// TODO Auto-generated method stub
		return false;
	}

}
